package com.langyiquan.backed.controller;

import com.langyiquan.service.ResourceService;
import com.langyiquan.utils.UnifyResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Api(value = "资源管理", tags = {"资源管理的相关接口"})
@RestController
@RequestMapping("resource")
public class ResourceController {

    @Autowired
    private ResourceService resourceService;

    @ApiOperation(value = "上传资源",notes = "上传资源",httpMethod = "POST")
    @PostMapping("upload")
    public UnifyResponse upload(MultipartFile file,@RequestParam String category){
        String url = resourceService.uploadFile(file,category);
        return UnifyResponse.success(url);
    }

}



